<html>
<head><meta charset="utf-8"><title>Refactoring FnPointer and FnDef · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html">Refactoring FnPointer and FnDef</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="208512910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208512910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208512910">(Aug 31 2020 at 01:16)</a>:</h4>
<p>hey folks,<br>
I wanted to get in touch with chalk and <a href="https://github.com/rust-lang/chalk/issues/574">https://github.com/rust-lang/chalk/issues/574</a> looked like a good first issue.<br>
So far I merged the shared fields abi, safety and variadic into the new struct FnSig. (see <a href="https://github.com/memoryleak47/chalk/commit/8a029b5c4afeaaccadf2f6ebcdfc2c633e8d29ac">https://github.com/memoryleak47/chalk/commit/8a029b5c4afeaaccadf2f6ebcdfc2c633e8d29ac</a>)<br>
But now I wonder what <em>logic</em> code duplication the issue is actually referring to.</p>
<p>Also, I copied #[allow(missing_docs)] from the original struct over to FnSig. Is that a bad idea?</p>



<a name="208515731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208515731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208515731">(Aug 31 2020 at 02:45)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="335294">@memoryleak47</span></p>



<a name="208515732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208515732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208515732">(Aug 31 2020 at 02:45)</a>:</h4>
<p>That commit looks good, and surprisingly minimal</p>



<a name="208515778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208515778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208515778">(Aug 31 2020 at 02:46)</a>:</h4>
<p>I can't actually think off the top of my head what else might need to be done for that</p>



<a name="208515784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208515784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208515784">(Aug 31 2020 at 02:47)</a>:</h4>
<p>(though I don't see anything regarding logic in the issue, just "lots of")</p>



<a name="208515838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208515838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208515838">(Aug 31 2020 at 02:49)</a>:</h4>
<p>I will take a closer look tomorrow though!</p>



<a name="208516455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208516455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Whitaker <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208516455">(Aug 31 2020 at 03:12)</a>:</h4>
<p>Hi! I wrote that issue, I think in retrospect "a lot" was an overstatement <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span>.</p>



<a name="208516457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208516457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Whitaker <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208516457">(Aug 31 2020 at 03:12)</a>:</h4>
<p>I believe I was mostly referring to duplication in the parsing and lowering code (in <code>chalk-integration</code>). I think I had in mind that we could add a separate rule for parsing the <code>FnSig</code> and use that for both <code>FnPointer</code>and <code>FnDef</code> (and then lowering could be cleaned up some too).</p>



<a name="208527476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208527476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208527476">(Aug 31 2020 at 07:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="335294">memoryleak47</span> <a href="#narrow/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef/near/208512910">said</a>:</p>
<blockquote>
<p>Also, I copied #[allow(missing_docs)] from the original struct over to FnSig. Is that a bad idea?</p>
</blockquote>
<p>That's mainly to avoid needing to document fields with clear names that point to documented structs, like "abi: holds the function abi". But <code>FnSig</code> itself should be documented, and maybe the <code>variadic</code> field as well</p>



<a name="208589685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208589685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208589685">(Aug 31 2020 at 17:28)</a>:</h4>
<p>Thanks for the answers! I now de-duplicated the lowering, and added an AST-version of FnSig to chalk-parse/src/ast.rs (see <a href="https://github.com/memoryleak47/chalk/commit/58628f9883b53d17c2cf470d4f673b913ffc7290">https://github.com/memoryleak47/chalk/commit/58628f9883b53d17c2cf470d4f673b913ffc7290</a>).<br>
Is there anything else I missed, except for docs?</p>



<a name="208755710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208755710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208755710">(Sep 01 2020 at 22:13)</a>:</h4>
<p>I just opened a PR (<a href="https://github.com/rust-lang/chalk/pull/599">https://github.com/rust-lang/chalk/pull/599</a>), but it seems to be unable to build the book.<br>
Any pointers on why this may happen?</p>



<a name="208757290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208757290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bram van den Heuvel <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208757290">(Sep 01 2020 at 22:30)</a>:</h4>
<p>Might have something to do with the recent renaming of directories?</p>



<a name="208779193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208779193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208779193">(Sep 02 2020 at 04:41)</a>:</h4>
<p>Indeed. Book <em>building</em> is fine. A couple links are broken, but unrelated</p>



<a name="208785951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Refactoring%20FnPointer%20and%20FnDef/near/208785951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Refactoring.20FnPointer.20and.20FnDef.html#208785951">(Sep 02 2020 at 06:53)</a>:</h4>
<p>links are being fixed in <a href="https://github.com/rust-lang-nursery/chalk/issues/600">chalk#600</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>